﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TenpointSystem.Biz;
using TenpointSystem.Common.Db;
using TenpointSystem.Common;
using TenpointSystem.Domian;

namespace TenpointSystem.Service
{
    public class LoginFormService
    {
        public bool isVaildUser( string loginName, string password )
        {
            MySqlConnector.openDataAccess();

            try
            {
                UserBiz biz = new UserBiz();
                User user = biz.getUserInfo( loginName, password );
                if (user == null)
                {
                    return false;
                }
                SystemEntity.setUser(user);
                return true;
            }
            catch
            {
                return false;
            }
            finally
            {
                MySqlConnector.closeDataAccess();
            }
        }
    }
}
